
from sprite import *
from common import *
from buffalo import *
from bird import *
from bear import *

class Spawner(GameSprite):
	
	def __init__(self, spawn_type, **kwargs):
		GameSprite.__init__(self, "small_cactus.png", **kwargs)
		self.right = False
		self.left = False
		self.speed = 0
		self.dammage = 0
		self.health = 1e99
		self.count_down = 5
		self.spawn_type = spawn_type
		self.name = "spawn"
		self.y = 0
		self.touch_ground()
	
	def die(self):
		self.health = 1e99
	
	def update(self, dt):
		self.count_down -= dt
		if (self.count_down < 0):
			self.count_down = 5
			if (self.x - Game.sprites[0].x > 400):
				if (self.spawn_type == "buffalo"):
					Game.sprites.append(Buffalo(x=self.x))
				elif (self.spawn_type == "bird"):
					Game.sprites.append(Bird(x=self.x))
				elif (self.spawn_type == "bear"):
					Game.sprites.append(Bear(x=self.x))
